<?php
define('SH_VERSION','2.0.0');
//list($one,$two,$there) = explode("/",$_SERVER['PATH_INFO']);
//echo $_SERVER['PATH_INFO'];
//echo $one;
//echo $two;
//echo $there;

require_once 'config.php';
$config = new config();

require_once $config->commonDir.'/base.php';
$base = new base($config);

$config = $base->config;

//控制器与函数 url
$controller = $base->getURLSegment(0);
$function = $base->getURLSegment(1);

if($function == '') {
	$function = $config->defaultfunction;
}

if(in_array($controller,array('account','photo','group'))) {
	include_once $config->controllersDir."/$controller.php";
	$control = new $controller($base);
	if($base->isFunctionInObject($control,$function)) {
		$control->$function();
	}
} else {
	//error
}

function site_url($uri) {
	$config = new config();
	return $config->siteURL.'/'.$uri;
}

function site_js_url($uri) {
	$config = new config();
	return $config->siteDir.'/'.$uri;
}



?>